package com.ramotion.expandingcollection;

import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import com.ramotion.expandingcollection.pojo.CardData;
import com.ramotion.expandingcollection.pojo.Comment;


/**
 * ExampleDataset
 *
 * @since 2021-05-31
 */
public class ExampleDataset {
    private static final int CONSTANT_5 = 5;
    private static final int CONSTANT_6 = 6;
    private List<EcCardData> dataset;

    /**
     * ExampleDataset
     */
    public ExampleDataset() {
        dataset = new ArrayList<>(CONSTANT_5);

        CardData item5 = new CardData();
        item5.setMainBackgroundResource(ResourceTable.Media_attractions);
        item5.setHeadBackgroundResource(ResourceTable.Media_attractions_head);
        item5.setHeadTitle("Attractions");
        item5.setPersonMessage("Usus de bassus buxum, desiderium index!");
        item5.setPersonName("Marjorie Ellis");
        item5.setPersonPictureResource(ResourceTable.Media_marjorie_ellis);
        item5.setListItems(prepareCommentsArray());
        dataset.add(item5);

        CardData item4 = new CardData();
        item4.setMainBackgroundResource(ResourceTable.Media_city_scape);
        item4.setHeadBackgroundResource(ResourceTable.Media_city_scape_head);
        item4.setHeadTitle("City Scape");
        item4.setPersonMessage("Solems manducare, tanquam neuter verpa.");
        item4.setPersonName("Mattew Jordan");
        item4.setPersonPictureResource(ResourceTable.Media_mattew_jordan);
        item4.setListItems(prepareCommentsArray());
        dataset.add(item4);

        CardData item3 = new CardData();
        item3.setMainBackgroundResource(ResourceTable.Media_cuisine);
        item3.setHeadBackgroundResource(ResourceTable.Media_cuisine_head);
        item3.setHeadTitle("Cuisine");
        item3.setPersonMessage("Magnum lacteas ducunt ad orexis.");
        item3.setPersonName("Ross Rodriguez");
        item3.setPersonPictureResource(ResourceTable.Media_ross_rodriguez);
        item3.setListItems(prepareCommentsArray());
        dataset.add(item3);

        CardData item2 = new CardData();
        item2.setMainBackgroundResource(ResourceTable.Media_nature);
        item2.setHeadBackgroundResource(ResourceTable.Media_nature_head);
        item2.setHeadTitle("Nature");
        item2.setPersonName("Tina Caldwell");
        item2.setPersonMessage("Nunquam perdere clabulare.");
        item2.setListItems(prepareCommentsArray());
        item2.setPersonPictureResource(ResourceTable.Media_tina_caldwell);
        dataset.add(item2);

        CardData item1 = new CardData();
        item1.setMainBackgroundResource(ResourceTable.Media_night_life);
        item1.setHeadBackgroundResource(ResourceTable.Media_night_life_head);
        item1.setHeadTitle("Night Life");
        item1.setPersonMessage("Cur adelphis studere?");
        item1.setPersonName("Wallace Sutton");
        item1.setPersonPictureResource(ResourceTable.Media_wallace_sutton);
        item1.setListItems(prepareCommentsArray());
        dataset.add(item1);
    }

    /**
     * getDataset
     *
     * @return dataset
     */
    public List<EcCardData> getDataset() {
        Collections.shuffle(dataset);
        return dataset;
    }

    private List<Comment> prepareCommentsArray() {
        SecureRandom random = new SecureRandom();
        List<Comment> comments = new ArrayList<>();
        comments.addAll(Arrays.asList(
                new Comment(ResourceTable.Media_aaron_bradley, "Aaron Bradley",
                        "When the sensor experiments for deep space, all mermaids accelerate mysterious, vital moons.",
                        "jan 12, 2014"),
                new Comment(ResourceTable.Media_barry_allen, "Barry Allen",
                        "It is an cold powerdrain, sir." + System.lineSeparator(), "jun 1, 2015"),
                new Comment(ResourceTable.Media_bella_holmes, "Bella Holmes",
                        "Particle of an calm shield, control the alignment!", "sep 21, 1937"),
                new Comment(ResourceTable.Media_caroline_shaw, "Caroline Shaw",
                        "The human kahless quickly promises the phenomenan.", "may 23, 1967"),
                new Comment(ResourceTable.Media_connor_graham, "Connor Graham",
                        "Ionic cannon at the infinity room was the sensor of voyage, imitated to an dead pathway.",
                        "sep 1, 1972"),
                new Comment(ResourceTable.Media_deann_hunt, "Deann Hunt",
                        "Vital particles, to the port." + System.lineSeparator(), "aug 13, 1995"),
                new Comment(ResourceTable.Media_ella_cole, "Ella Cole",
                        "Stars fly with hypnosis at the boldly infinity room!", "nov 18, 1952"),
                new Comment(ResourceTable.Media_jayden_shaw, "Jayden Shaw",
                        "Hypnosis, definition, and powerdrain.", "apr 1, 2013"),
                new Comment(ResourceTable.Media_jerry_carrol, "Jerry Carrol",
                        "When the queen experiments for nowhere, all particles control reliable, cold captains.",
                        "nov 14, 1964"),
                new Comment(ResourceTable.Media_lena_lucas, "Lena Lukas",
                        "When the c-beam experiments for astral city, all cosmonauts acquire remarkable,"
                                + " virtual lieutenant commanders.", "may 4, 1965"),
                new Comment(ResourceTable.Media_leonrd_kim, "Leonard Kim",
                        "Starships walk with love at the cold parallel universe!", "jul 3, 1974"),
                new Comment(ResourceTable.Media_marc_baker, "Mark Baker",
                        "Friendship at the bridge that is when quirky green people yell.", "dec 24, 1989")));
        Collections.shuffle(comments);
        return comments.subList(0, CONSTANT_6 + random.nextInt(CONSTANT_5));
    }
}
